package logic

import (
	"context"
	"user-management/usersrpc/models/mysql"

	"user-management/usersrpc/internal/svc"
	"user-management/usersrpc/usersrpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type UserDelLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewUserDelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserDelLogic {
	return &UserDelLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *UserDelLogic) UserDel(in *usersrpc.UserDelRequest) (*usersrpc.UserDelResponse, error) {
	// todo: add your logic here and delete this line

	mysql.DB.Debug().Where("id=?", in.Id).Delete(&mysql.User{})
	return &usersrpc.UserDelResponse{}, nil
}
